import 'package:flutter/material.dart';

class LogoApp extends StatefulWidget {
  const LogoApp({Key? key}) : super(key: key);

  @override
  _LogoAppState createState() => _LogoAppState();
}

class _LogoAppState extends State<LogoApp> with TickerProviderStateMixin {
  AnimationController? _animationController;
  Animation<double>? _animation;

  @override
  void dispose() {
    _animationController!.dispose();
    super.dispose();
  }

  @override
  void initState() {
    _init();
    super.initState();
  }

  _init() {
    _animationController = AnimationController(duration: const Duration(milliseconds: 2000), vsync: this);
    CurvedAnimation curved = CurvedAnimation(parent: _animationController!, curve: Curves.easeIn);
    _animation = Tween(begin: 0.0, end: 300.0).animate(curved);
    _animationController!.forward();
  }

  @override
  Widget build(BuildContext context) {
    return GrowTransition(child: const LogoWidget(), animation: _animation!);
  }
}


class LogoWidget extends StatelessWidget {
  const LogoWidget({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.symmetric(vertical: 5),
      child: const FlutterLogo(),
    );
  }
}


class GrowTransition extends StatelessWidget {
  final Widget? child;
  final Animation<double>? animation;
  const GrowTransition({Key? key, this.child, this.animation}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Center(
      child: AnimatedBuilder(
        animation: animation!,
        builder: (context, widget) {
          return SizedBox(
            height: animation!.value,
            width: animation!.value,
            child: child,
          );
        },
        child: child,
      ),
    );
  }
}
